#include <stdio.h>
#include <unistd.h>
#include <pthread.h>

void* my_thread_start(void* arg){
    pthread_detach(pthread_self());
    (void)arg;
    int count = 50;
    while(count--){
        printf("i am work thread\n");
        sleep(1);
    }
    return NULL;
}

int main(){
    //1.创建工作线程
    pthread_t tid;
    int ret = pthread_create(&tid, NULL, my_thread_start, NULL);
    if(ret < 0){
        perror("pthread_create");
        return 0;
    }

    while(1){
        sleep(1);
    }
    return 0;
}

